<?php

/**
 * Comment form base class.
 *
 * @package    form
 * @subpackage comment
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseCommentForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'         => new sfWidgetFormInputHidden(),
      'id_user'    => new sfWidgetFormDoctrineSelect(array('model' => 'User', 'add_empty' => false)),
      'date'       => new sfWidgetFormInput(),
      'texte'      => new sfWidgetFormTextarea(),
      'is_visible' => new sfWidgetFormInputCheckbox(),
    ));

    $this->setValidators(array(
      'id'         => new sfValidatorDoctrineChoice(array('model' => 'Comment', 'column' => 'id', 'required' => false)),
      'id_user'    => new sfValidatorDoctrineChoice(array('model' => 'User')),
      'date'       => new sfValidatorString(array('max_length' => 64)),
      'texte'      => new sfValidatorString(),
      'is_visible' => new sfValidatorBoolean(),
    ));

    $this->widgetSchema->setNameFormat('comment[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Comment';
  }

}